﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using University.Workshop.DataAccess;
using System.Data;

namespace University.Workshop.Business
{
    public static class FunctionsManager
    {
        public static DataTable LoadDataFunctions(string nameRole)
        {
            return RoleDataAccess.LoadDataFunctions(nameRole);
        }

        public static DataTable LoadDataRoles()
        {
            return RoleDataAccess.LoadDataRoles();
        }

        public static DataTable LoadDataFunctionOfRole(string nameRole)
        {
            return RoleDataAccess.LoadDataFunctionOfRole(nameRole);
        }

        public static DataTable LoadDataRolesOfTheUser(string ciUser)
        {
            return RoleDataAccess.LoadDataRolesOfTheUser(ciUser);
        }

        public static DataTable LoadRolesAvailableForTheUserSelected(string ciUser)
        {
            return RoleDataAccess.LoadRolesAvailableForTheUserSelected(ciUser);
        }

        public static bool AddFunction(string nameRole, string nameFunction)
        {
              return RoleDataAccess.AddFunction(nameRole,nameFunction);
        }

        public static bool RemoveFunctionOfTheRole(string nameRole, string nameFunction)
        {
            return RoleDataAccess.RemoveFunctionOfTheRole(nameRole, nameFunction);
        }

        public static bool AddRole(string nameRole)
        {
            return RoleDataAccess.AddRole(nameRole);
        }

        public static bool LoadDataRoles(string nameRole)
        {
            return RoleDataAccess.LoadDataRoles(nameRole).Rows.Count<=0;
        }

        

        public static bool DeleteRole(string nameRole)
        {
            return RoleDataAccess.DeleteRole(nameRole);
        }



        public static bool AddRoleToUser(string ciUser, string nameRole)
        {
            return RoleDataAccess.AddRoleToUser(ciUser, nameRole);
        }

        public static bool RemoveRoleOfTheUser(string ciUser, string nameRole)
        {
            return RoleDataAccess.RemoveRoleOfTheUser(ciUser,nameRole);
        }
    }
}
